Update deps
authorAlex Crichton <alex@alexcrichton.com>
Thu, 11 Sep 2014 23:57:25 +0000 (16:57 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 16 Sep 2014 19:05:21 +0000 (12:05 -0700)
Cargo.lock
src/cargo/sources/git/utils.rs
src/cargo/sources/registry.rs
src/cargo/util/config.rs
tests/support/git.rs
tests/test_cargo_registry.rs

index 294fcd522054798df9ce8156b472c440c7c0e4b4..0633d1c5d5c0cd9d79d190d35358e13172b58d8d 100644 (file)
@@ -2,6 +2,7 @@
 name = "cargo"
 version = "0.0.1-pre"
 dependencies = [
+ "curl 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c738c397252cf3c26d428bdca697d4)",
  "docopt 0.6.3 (git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085)",
  "docopt_macros 0.6.3 (git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085)",
  "flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs#a59b2a103642550bc1500c302c5031479ec7d9e1)",
@@ -14,6 +15,21 @@ dependencies = [
  "url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
 ]
 
+[[package]]
+name = "curl"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c738c397252cf3c26d428bdca697d4"
+dependencies = [
+ "curl-sys 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c738c397252cf3c26d428bdca697d4)",
+ "link-config 0.0.1 (git+https://github.com/alexcrichton/link-config#1d3cd271612036b47c015a55f33a97e1524569ae)",
+ "url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
+]
+
+[[package]]
+name = "curl-sys"
+version = "0.0.1"
+source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c738c397252cf3c26d428bdca697d4"
+
 [[package]]
 name = "docopt"
 version = "0.6.3"
index 693b96e9d830a772ec7994db17b4430bba41aa5c..532508865f172f6882fb21e1ebe955e821e67afe 100644 (file)
@@ -185,7 +185,7 @@ impl GitRemote {
         }
         try!(mkdir_recursive(dst, UserDir));
         let repo = try!(git2::Repository::init_bare(dst));
-        try!(fetch(&repo, url.as_slice()));
+        try!(fetch(&repo, url.as_slice(), "refs/heads/*:refs/heads/*"));
         Ok(repo)
     }
 }
@@ -287,7 +287,8 @@ impl<'a> GitCheckout<'a> {
         info!("fetch {}", self.repo.path().display());
         let url = try!(self.database.path.to_url().map_err(human));
         let url = url.to_string();
-        try!(fetch(&self.repo, url.as_slice()));
+        let refspec = "refs/heads/*:refs/heads/*";
+        try!(fetch(&self.repo, url.as_slice(), refspec));
         Ok(())
     }
 
index 82abb06bae1ad5f0e8db275c1eb4a0c8438feda1..5503aab0c961ab00989887ff0bb4a6344d6d1414 100644 (file)
@@ -1,5 +1,6 @@
 #![allow(unused)]
 use std::io::{mod, fs, File, MemReader};
+use std::io::fs::PathExtensions;
 use std::collections::HashMap;
 
 use curl::http;
@@ -182,10 +183,10 @@ impl<'a, 'b> Registry for RegistrySource<'a, 'b> {
     fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
         let mut chars = dep.get_name().chars();
         let path = self.checkout_path.clone();
-        let path = path.join(format!("{}{}", chars.next().unwrap_or('X'),
-                                     chars.next().unwrap_or('X')));
-        let path = path.join(format!("{}{}", chars.next().unwrap_or('X'),
-                                     chars.next().unwrap_or('X')));
+        let path = path.join(format!("{}{}", chars.next().unwrap_or(':'),
+                                     chars.next().unwrap_or(':')));
+        let path = path.join(format!("{}{}", chars.next().unwrap_or(':'),
+                                     chars.next().unwrap_or(':')));
         let path = path.join(dep.get_name());
         let contents = match File::open(&path) {
             Ok(mut f) => try!(f.read_to_string()),
@@ -236,9 +237,9 @@ impl<'a, 'b> Source for RegistrySource<'a, 'b> {
 
         // git reset --hard origin/master
         let reference = "refs/remotes/origin/master";
-        let oid = try!(git2::Reference::name_to_id(&repo, reference));
+        let oid = try!(repo.refname_to_id(reference));
         log!(5, "[{}] updating to rev {}", self.source_id, oid);
-        let object = try!(git2::Object::lookup(&repo, oid, None));
+        let object = try!(repo.find_object(oid, None));
         try!(repo.reset(&object, git2::Hard, None, None));
         Ok(())
     }
index de382e12c47a6eb9746e79dcb45b708d6ae4c944..c0324b89190eabd113025c29d6c4df3dde7469ec 100644 (file)
@@ -1,5 +1,5 @@
-use std::{io, fmt, os, result, mem};
-use std::io::fs::PathExtensions;
+use std::{fmt, os, result, mem};
+use std::io::fs::{PathExtensions, File};
 use std::collections::HashMap;
 use serialize::{Encodable,Encoder};
 use toml;
index e2c9d23910cdc46490395dcdf4915281a06b6994..010b1da7af220498a110dae133cc551cd81fe90b 100644 (file)
@@ -42,9 +42,9 @@ impl RepoBuilder {
         }
         index.write().unwrap();
         let id = index.write_tree().unwrap();
-        let tree = git2::Tree::lookup(&self.repo, id).unwrap();
-        let sig = git2::Signature::default(&self.repo).unwrap();
-        git2::Commit::new(&self.repo, Some("HEAD"), &sig, &sig,
-                          "Initial commit", &tree, []).unwrap();
+        let tree = self.repo.find_tree(id).unwrap();
+        let sig = self.repo.signature().unwrap();
+        self.repo.commit(Some("HEAD"), &sig, &sig,
+                         "Initial commit", &tree, []).unwrap();
     }
 }
index 4ecbf476839a7aa58b2be1544df57c3399057e15..1a148a50e43b17691364df24f15d913c969c32ee 100644 (file)
@@ -45,8 +45,8 @@ fn setup() {
         .file("config.json", format!(r#"
             {{"dl":"{}","upload":""}}
         "#, dl_url()).as_slice())
-        .file("fo/oX/foo", pkg("foo", "0.0.1", [], &foo_cksum))
-        .file("ba/rX/bar", pkg("bar", "0.0.1", ["foo|>=0.0.0"], &bar_cksum))
+        .file("fo/o:/foo", pkg("foo", "0.0.1", [], &foo_cksum))
+        .file("ba/r:/bar", pkg("bar", "0.0.1", ["foo|>=0.0.0"], &bar_cksum))
         .file("ba/d-/bad-cksum", pkg("bad-cksum", "0.0.1", [], &bar_cksum))
         .nocommit_file("no/ty/notyet", pkg("notyet", "0.0.1", [], &notyet))
         .build();
@@ -206,13 +206,13 @@ Version required: >= 0.0.0
     let mut index = repo.index().unwrap();
     index.add_path(&Path::new("no/ty/notyet")).unwrap();
     let id = index.write_tree().unwrap();
-    let tree = git2::Tree::lookup(&repo, id).unwrap();
-    let sig = git2::Signature::default(&repo).unwrap();
-    let parent = git2::Reference::name_to_id(&repo, "refs/heads/master").unwrap();
-    let parent = git2::Commit::lookup(&repo, parent).unwrap();
-    git2::Commit::new(&repo, Some("HEAD"), &sig, &sig,
-                      "Another commit", &tree,
-                      [&parent]).unwrap();
+    let tree = repo.find_tree(id).unwrap();
+    let sig = repo.signature().unwrap();
+    let parent = repo.refname_to_id("refs/heads/master").unwrap();
+    let parent = repo.find_commit(parent).unwrap();
+    repo.commit(Some("HEAD"), &sig, &sig,
+                "Another commit", &tree,
+                [&parent]).unwrap();
 
     assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0).with_stdout(format!("\